<?php

class GPCSFilter
{
    public function __construct()
    {
        self::filter();
    }

    public static function filter()
    {
        self::filterGet();
        self::filterPost();
        self::filterCookie();
        self::filterSession();
    }
    public static function filterGet()
    {
        $_GET = array_map("addslashes", $_GET);
        $_GET = array_map("htmlspecialchars", $_GET);
        return true;
    }

    public static function filterPost()
    {
        $_POST = array_map("addslashes", $_POST);
        $_POST = array_map("htmlspecialchars", $_POST);
        return true;
    }

    public static function filterCookie()
    {
        $_COOKIE = array_map("addslashes", $_COOKIE);
        $_COOKIE = array_map("htmlspecialchars", $_COOKIE);
        return true;
    }

    public static function filterSession()
    {
        $_SESSION = array_map("addslashes", $_SESSION);
        $_SESSION = array_map("htmlspecialchars", $_SESSION);
        return true;
    }

    public function __destruct()
    {
        self::filter();
    }
}

?>